import './Mars3dSetUp.scss'
import { Button } from 'antd'
import PropTypes from 'prop-types'

import { optionsList } from '../../Assets/Params'
import { UseConfigSection } from '../../Template/FormTemplate'

const Mars3dPutEle = ({ data, ModalEvent, Off }) => {
    Mars3dPutEle.propTypes = { data: PropTypes.object, ModalEvent: PropTypes.object, Off: PropTypes.func }
    const { obj, uuid } = data
    const list = [
        { key: 101, uuid, label: '元素名称', type: 'InputTemp', name: 'title' },
        { key: 102, uuid, label: '元素排序', type: 'InputNumberTemp', name: 'sortId' },
        { key: 103, uuid, label: '是否启用', type: 'RadioTemp', name: 'isEnable', options: optionsList.isEnable },
    ]

    const onSubmit = () => {
        ModalEvent.emit({ type: 'details', data: obj })
        Off()
    }
    return (
        <div className='Mars3dSetUp Mars3dAddEle'>
            <div className='FormList'>
                {UseConfigSection(obj, list)}
            </div>
            <div className='Button'>
                <Button type='primary' danger onClick={Off}>取消</Button>
                <Button type='primary' onClick={onSubmit}>保存</Button>
            </div>
        </div>
    )
};

export default Mars3dPutEle